
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="keywords" content="">
  <meta name="description" content="">
  <title>Rightgrc管理系统</title>
  <link rel="stylesheet" href=" https://static-src.rightgrc.com/admin/css/admin.css?v=20200316"/>
  <link rel="stylesheet" href=" https://static-src.rightgrc.com/admin/layui/css/layui.css?v=20200316"/>
  <script type="text/javascript" src=" https://static-src.rightgrc.com/admin/layui/layui.js?v=20200316"></script>
  <script type="text/javascript" src=" https://static-src.rightgrc.com/admin/layui/jquery.min.js?v=20200316"></script>
  <style>
    .customer-container{
      padding: 25px 30px;
    }
    .customer-title{
      font-size: 22px;
      color: #343945;
      letter-spacing: 2px;
      margin-bottom: 30px;
    }
    .customer-title strong{
      font-size: 24px;
    }
    .customer-search-panel{
      background: url("../dist/images/customer_bg.png") no-repeat 85% center;
    }
    @media screen and (max-width: 1440px) {
      .customer-search-panel {
        background-position: right center;
      }
    }
    .customer-label{
      min-width: auto!important;
      margin-right: 2.8%!important;
    }
    .customer-label .icon{
      width: 50px;
      height: 50px;
      display: block;
      background-repeat: no-repeat;
    }
    .customer-label .icon-1{
      background-image: url("../dist/images/customer_icon1.png");
    }
    .customer-label .icon-2{
      background-image: url("../dist/images/customer_icon2.png");
    }
    .customer-label .icon-3{
      background-image: url("../dist/images/customer_icon3.png");
    }
    .layui-form-item .layui-inline{
      min-width: 230px;
      margin-right: 1.5%;
    }
    .customer-btn-group{
      padding: 20px 0 10px;
      margin-top: 20px;
      background-image: linear-gradient(to right, #e8e8e8 0%, #e8e8e8 50%, transparent 50%);
      background-size: 14px 1px;
      background-repeat: repeat-x;
    }
    .customer-btn-group .layui-btn{
      min-width: 80px;
      padding: 0 15px;
      margin-left: 0;
    }
    .customer-btn-group .layui-btn-primary{
      border-color: #34424f;
      color: #34424f;
    }
    .layui-btn .icon{
      width: 16px;
      height: 16px;
      display: inline-block;
      vertical-align: -2px;
      background-repeat: no-repeat;
      margin-right: 5px;
    }
    .layui-btn .icon-add{
      background-image: url("../dist/images/customer_rect1.png");
    }
    .layui-btn .icon-export{
      background-image: url("../dist/images/customer_rect2.png");
    }
    .layui-btn .icon-search{
      background-image: url("../dist/images/customer_rect3.png");
    }
    .layui-btn.search{
      width: 140px;
    }
    .layui-btn-normal{
      background-color: #4bb2ff;
    }
    .layui-form-select dl dd.layui-this{
      background-color: #4bb2ff;
    }
  </style>
</head>
<body>
<div class="customer-container">
  <form class="layui-form" action="">
    <div class="demoTable">
      <div class="customer-search-panel">
        <div class="customer-title">客户案例库<strong>检索</strong></div>
        <div class="layui-form-item">
          <div class="layui-inline customer-label">
            <span class="icon icon-1"></span>
          </div>
          <div class="layui-inline">
            <input class="layui-input" placeholder="客户名称" id="businessName" autocomplete="off">
          </div>
          <div class="layui-inline">
            <select name="service" lay-filter="production_line" id="industry" lay-search="" lay-verify="required">
              <option value="">请选择行业</option>
              <option value="1">农、林、牧、渔业</option>
              <option value="2">采矿</option>
              <option value="3">制造</option>
              <option value="4">电力、热力、燃气及水生产和供应</option>
              <option value="5">建筑</option>
              <option value="6">交通运输、仓储和邮政</option>
              <option value="7">信息传输、软件和信息技术服务业</option>
              <option value="8">批发和零售</option>
              <option value="9">食品饮料</option>
              <option value="10">酒店</option>
              <option value="11">金融</option>
              <option value="12">房地产</option>
              <option value="13">租赁和商务服务</option>
              <option value="14">科学研究和技术服务</option>
              <option value="15">水利、环境和公共设施管理</option>
              <option value="16">居民服务、修理和其他服务</option>
              <option value="17">教育</option>
              <option value="18">卫生和社会工作</option>
              <option value="19">文化、体育和娱乐</option>
              <option value="20">公共管理、社会保障和社会组织</option>
              <option value="21">政府服务</option>
              <option value="22">国际组织</option>
              <option value="23">快速消费品</option>
              <option value="24">耐用消费品</option>
              <option value="25">汽车</option>
              <option value="26">保险</option>
              <option value="27">医药</option>
              <option value="28">互联网</option>
              <option value="29">其它</option>
            </select>
          </div>
          <div class="layui-inline">
            <select name="service" lay-filter="production_line" id="business_nature" lay-search="" lay-verify="required">
              <option value="">请选择企业性质</option>
              <option value="1">外企</option>
              <option value="2">民企</option>
              <option value="3">国企</option>
            </select>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline customer-label">
            <span class="icon icon-2"></span>
          </div>
          <div class="layui-inline">
            <input class="layui-input" placeholder="实施顾问" id="clientNumber" autocomplete="off">
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline customer-label">
            <span class="icon icon-3"></span>
          </div>
          <div class="layui-inline">
            <select name="service" lay-filter="production_line" id="program_type" lay-search="" lay-verify="required">
              <option value="">请选择二级分类</option>
              <option value="1">测评工具</option>
              <option value="2">测评中心</option>
              <option value="3">高管教练</option>
              <option value="4">裁员转职</option>
              <option value="5">职业发展</option>
              <option value="6">组织发展</option>
              <option value="7">复杂咨询</option>
              <option value="8">领导力</option>
              <option value="9">培训发展</option>
            </select>
          </div>
          <div class="layui-inline">
            <input class="layui-input" placeholder="模糊查询" id="description" autocomplete="off">
          </div>
          <div class="layui-inline" style="text-align: right">
            <a class="layui-btn layui-btn-radius layui-btn-normal search" data-type="reload"><i class="icon icon-search"></i>搜索</a>
          </div>
        </div>
      </div>
      <div class="customer-btn-group">
        <a class="layui-btn layui-btn-primary" href="/Clientele/index">重置</a>
        <a class="layui-btn layui-btn-normal add"><i class="icon icon-add"></i>添加</a>
        <a class="layui-btn layui-btn-danger"><i class="icon icon-export"></i>导出</a>
      </div>
    </div>
  </form>
  <table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>
</div>
<script>
  layui.use(['form', 'table'], function () {
    var table = layui.table, form = layui.form;
    //方法级渲染
    var tableIns = table.render({
      elem: '#LAY_table_user'
      , url: '/Clientele/ajax_index'
      //,toolbar: 'default'
      , cols: [[
        {field: 'logo', align: 'center', title: 'Logo'},
        {field: 'business_nature', align: 'center', title: '企业性质', sort: true}
        , {field: 'industry', align: 'center', title: '行业'}
        , {field: 'company_name_cn', align: 'center', title: '客户中文名'}
        , {field: 'company_name_en', align: 'center', title: '客户英文名'}
        , {field: 'program_time', align: 'center', title: '项目时间'}
        , {field: 'program_type_one', align: 'center', title: '一级分类'}
        , {field: 'program_type', align: 'center', title: '二级分类'}
        , {field: 'consultant', align: 'center', title: '实施顾问'}
        , {
          field: 'right', title: '操作', align: 'center', templet: function (d) {
            var _str = '';

            _str += '<button class="layui-btn layui-btn-xs " data-did = "' + d.clientNumber + '" lay-event="add_adress">编辑</button>'

            _str += '<button class="layui-btn layui-btn-xs layui-btn-warm " data-did = "' + d.clientNumber + '" lay-event="see">查看</button>'

            _str += '<button class="layui-btn layui-btn-xs layui-btn-danger " data-did = "' + d.clientNumber + '" lay-event="backup">克隆</button>'


            return _str;
          }
        }
      ]]
      , page: true
      , limit: 10
    });


    var $ = layui.$, active = {
      reload: function () {
        var businessName = $('#businessName').val();
        var consultant = $('#clientNumber').val();
        var business_nature = $('#business_nature').val();
        var industry = $('#industry').val();
        var program_type_one = $('#program_type_one').val();
        var program_type = $('#program_type').val();
        var description = $('#description').val();

        tableIns.reload({
          where: {
            businessName: businessName,
            consultant: consultant,
            business_nature:business_nature,
            industry:industry,
            program_type_one:program_type_one,
            program_type:program_type,
            description:description,
          }
        });
      }
    };


    $('.demoTable .layui-btn').on('click', function () {
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });

    //监听工具条
    table.on('tool(user)', function (obj) {
      var data = obj.data;
      var _userid = data.id;
      //编辑
      if (obj.event === 'editbusiness') {
        layer.open({
          type: 2
          , maxmin: true
          , area: ['100%', '100%']
          , title: "联系人列表"
          , content: '/business/contact_list/' + _userid
        });

      }

      if (obj.event === 'add_adress') {
        layer.open({
          type: 2
          , maxmin: true
          , area: ['100%', '100%']
          , title: "编辑"
          , content: '/Clientele/add/' + _userid
        });

      }

      if (obj.event === 'see') {
        layer.open({
          type: 2
          , maxmin: true
          , area: ['100%', '100%']
          , title: "查看详情"
          , content: '/Clientele/see/' + _userid
        });

      }



      if (obj.event === 'get_program') {
        layer.open({
          type: 2
          , maxmin: true
          , area: ['100%', '100%']
          , title: "项目列表"
          , content: '/business/program/' + _userid
        });

      }


      if (obj.event === 'add_contract') {
        layer.open({
          type: 2
          , maxmin: true
          , area: ['80%', '90%']
          , title: "商务合同"
          , content: '/business/contract/' + _userid
        });

      }

      //删除
      if (obj.event === 'backup') {

        $.post('/Clientele/backup', {id: _userid}, function (res) {
          if (res.status == 1) {
            parent.layer.msg(res.msg, {
              time: 1000, //1s后自动关闭
            });
            location.reload();
          } else {
            parent.layer.msg(res.msg, {
              time: 2000, //2s后自动关闭
            });
            layer.closeAll();
          }
        }, "json")

      }

    });
  });

  // 添加账户
  $(document).on("click", ".add", function () {
    layer.open({
      type: 2
      , area: ['100%', '100%']
      , title: "添加企业"
      , content: '/Clientele/add'
    });
  });

</script>
</body>
</html>
